﻿Imports SISSAT.BusinessLayer.Services
Imports SISSAT.BusinessLayer.DomainModels

Namespace Views
    Public Class SubjectPresenter

        Private Property View As ISubjectView
        Private Property Service As IScheduleService

        Public Sub New(view As ISubjectView)
            Service = New ScheduleService

            Me.View = view

            AddHandler Me.View.OnInitialization, AddressOf OnInitialization
        End Sub

        Private Sub OnInitialization()
            If Me.View.ScheduleId < 1 Then
                Return
            End If

            Dim entity As Schedule = Service.ReadById(Me.View.ScheduleId)
            Me.View.RoomNumber = entity.RoomNumber
            Me.View.ScheduleDay = entity.ScheduleDay
            Me.View.ScheduleTime = entity.ScheduleTime
        End Sub

    End Class
End Namespace

